#ifndef BUTTON_HANDLER_H
#define BUTTON_HANDLER_H

#include <Arduino.h>

class ButtonHandler {
public:
    ButtonHandler(uint8_t pin, bool pullup = true);
    void update();
    bool wasPressed();
    bool wasReleased();
    bool isPressed();
    unsigned long getPressDuration();
    bool getCurrentState() const { return _currentState; }
    
private:
    uint8_t _pin;
    bool _pullup;
    bool _lastState;
    bool _currentState;
    unsigned long _lastDebounceTime;
    unsigned long _pressStartTime;
    static const unsigned long debounceDelay = 50;
};

#endif